<div class="layui-form seller-form"  action="" >
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">文章标题：</label>
            <div class="layui-input-inline">
                <input type="text" name="title" lay-verify="title" placeholder="标题关键字" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-inline">
            <button class="layui-btn layui-btn-sm" lay-submit lay-filter="article_search">提交</button>
        </div>
    </div>
</div>

<table id="articleTable" lay-filter="articleTable"></table>
<script>
    layui.use(['table','form','layer','laydate'],function(){
        var layer = layui.layer, table = layui.table,form = layui.form,date = layui.laydate;
        //执行渲染
        table.render({
            elem: '#articleTable', //指定原始表格元素选择器（推荐id选择器）
            height: '330',
            cellMinWidth: '80',
            page: 'true',
            limit:'20',
            id:'articleTable',
            url: "{:url('Article/index')}",
            cols: [[ //标题栏
                {type: 'numbers'},
                {field: 'title', title: '标题',align:'center'},
                {field: 'tname', title: '类型',align:'center',sort:true},
                {field: 'is_pub', title: '状态',align:'center',sort:true,width:80},
                {fixed: 'right', width:150, title:'操作',align:'center', toolbar:'#articleBar'}
            ]]
        });

        //搜索
        form.on('submit(article_search)', function(data){
            console.log(data.field);
            layui.table.reload('articleTable', {
                where: data.field
                ,page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });

        date.render({
            elem: '#ctime',
            range: '~'
        });

        date.render({
            elem: '#utime',
            range: '~'
        });

    })
</script>

<script type="text/html" id="articleBar">
    <a class="layui-btn layui-btn-xs" lay-event="selectArticle">选择</a>
</script>
